package org.dawfinn.droiditarian.deedfavoriteupload;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;

import org.dawfinn.droiditarian.data.Deed;

public class InternetDeedFavoriteUpload implements DeedFavoriteUpload {

	private final String path;
	
	public InternetDeedFavoriteUpload(String path) {
		this.path = path;
	}

	public void sendDeedFavorite(Deed deed, boolean favorite) {
		try {
			URL url = new URL(path 
					+ "?id=" + URLEncoder.encode(deed.getServerId(), "UTF-8")
					+ "&favorite=" + URLEncoder.encode("" + favorite));

			url.openStream();
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}
